home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 5
/
Merciful - Disc 5.iso
/
software
/
r
/
real_3d
/
real3dv3.3b.dms
/
real3dv3.3b.adf
/
RPL.LZH
/
RPL
/
collide.rpl
< prev
next >
Wrap
Text File
|
1995-04-18
|
2KB
|
60 lines
( Collision detection hook examples
( ---------------------------------
( Some useful words
( -----------------
: Rebound ;
: NoRebound 2 l STORE ;
: CancelAnim 0 l STORE ;
( This hook makes the objects invisible as soon as they collide
( -------------------------------------------------------------
: CollInvisible
0 o1 FETCH o2 FETCH
lOF_RTINVISIBLE lOF_WFINVISIBLE + 0 2 M_ATTRIB
NoRebound
;
( This hook shrinks the collided objects about their COGs a bit in each
( collision.
( ---------------------------------------------------------------------
: CollSize
( make collided objects smaller
0 o1 FETCH DUP iOP_COG O_PROP 0.8 0 M_SIZE3D
0 o2 FETCH DUP iOP_COG O_PROP 0.8 0 M_SIZE3D
Rebound
;
( This hook tries to avoid collision by shrinking the objects and
( disabling collision processing.
( ---------------------------------------------------------------
: CollAvoid
0 o1 FETCH DUP iOP_COG O_PROP 0.7 0 M_SIZE3D
0 o2 FETCH DUP iOP_COG O_PROP 0.7 0 M_SIZE3D
NoRebound
;
( This example opens a requester for each detected collision
( -----------------------------------------------------------
: CollHurts
"STOP ANIMATION|I DON'T MIND" "OUTS! It hurts" GET_KEY
IF
CancelAnim
ELSE
Rebound
ENDIF
;
( This hook copies a file 'R3D2:macros/speak to the SPEAK: device
( causing your Amiga to say 'Oooh' whenever objects collide. Make
( sure you have mounted the device SPEAK: before trying this.
( ---------------------------------------------------------------
: CollSayOooh
"echo Oooh >SPEAK:" SYSTEM
Rebound
;